home *** CD-ROM | disk | FTP | other *** search
-
- * NoPalReset by Declan Mc Ardle.
- * Detects if Amiga is in NTSC or PAL mode, resets if in NTSC mode.
-
- INCLUDE "includes:exec/types.i"
- INCLUDE "includes:graphics/gfxbase.i"
- INCLUDE "includes:exec/exec_lib.i"
-
- section NoPalReset,code
-
- execbase equ 4
-
- jsr opengfx ;Try and open graphics library.
- tst d0 ;Is it 0 ?
- beq exit ;If so exit, else
- move.l GfxBase,a1 ;Put GfxBase in a1.
- move.w gb_DisplayFlags(a1),d0 ;Put gb_DisplayFlags in d0.
- cmp.w #1,d0 ;Compare it with 1 (NTSC).
- beq reboot ;If it's equal, reset.
-
- exit:
- jsr closegfx ;Close graphics library.
- clr.l d0 ;Clear d0.
- rts ;Go back to CLI.
-
- reboot:
- even ;IMPORTANT: Must be longword aligned.
- move.l execbase,a6 ;Get a pointer to ExecBase.
- lea.l MagicResetCode(pc),a5 ;Location of code to trap to
- jsr _LVOSupervisor(a6) ;start code (must use jsr).
-
- MagicResetCode:
- lea.l 2,a0 ;Point to jmp instruction at start of rom.
- reset ;All ram goes away now!
- jmp (a0) ;Rely on prefetch to execute this instruction.
-
- opengfx:
- move.l execbase,a6 ;Put 4 in a6.
- lea gfxlib,a1 ;Put GfxBase in a1.
- move.l #0,d0 ;Any version.
- jsr _LVOOpenLibrary(a6) ;OpenLibary()
- move.l d0,GfxBase ;Put address in GfxBase.
- rts ;Return.
-
- closegfx:
- move.l GfxBase,a1 ;Move address in GfxBase to a1
- jsr _LVOCloseLibrary(a6) ;and CloseLibrary()
- rts ;Return.
-
- gfxlib: dc.b 'graphics.library',0
- myname: dc.b 'NoPalReset by Declan Mc Ardle.',0
-
- end
-